import i18n from '@/language/index'

export const t = i18n.global.t

export default function UserModel(id, nickName,account,password,email,enableTag,roleId) {
    this.id = id;
    this.nickName = nickName;
    this.account = account;
    this.password = password;
    this.email = email;
    this.enableTag = enableTag || true;
    this.roleId = roleId;

    this.rules = {
        nickName: [
            {required: true, message: t('user.1'), trigger: 'blur'},
        ],
        email: [
            {required: true, message: t('user.2'), trigger: 'blur'},
        ],
        account: [
            {required: true, message: t('user.3'), trigger: 'blur'},
            {min: 6, message: t('user.4'), trigger: 'blur'}
        ],
        password: [
            {required: true, message: t('user.5'), trigger: 'blur'},
            {min: 6, message: t('user.9'), trigger: 'blur'}
        ],
        roleId: [
            {required: true, message: t('user.6'), trigger: 'blur'}
        ]
    }
}